This repository was archived by the owner on Jul 19, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
Support python3 #135
Merged
Merged
Support python3 #135
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
551e605 to
5f49d05
Compare
* Support a `python_version` value under `python` key in config * Use `python3` when this is set appropriately * Update the `parser.py` script to work in both versions
pbrisbin
reviewed
Oct 7, 2016
| end | ||
|
|
||
| def python_version | ||
| engine_config.languages.fetch("python", {}).fetch("python_version", 2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thoughts on hoisting 2 to DEFAULT_PYTHON_VERSION?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure sure. Done.
|
Awesome. I'm happy to see how relatively easy it was to make this engine multi-version. |
Closed
wfleming
added a commit
that referenced
this pull request
Oct 10, 2016
Addresses #136 The changes made in #135 didn't account for configuring the languages with empty hash contents. With YAML parsing, something like ``` languages: python: ``` Gets parsed as `{ "languages" => { "python" => "" } }`, leading to a `NoMethodError` when the Python class attempted to discover the configured Python version. `EngineConfig` already had logic to ensure a language configuration was a hash, so this makes the appropriate coercing method public & uses it from the Python class. (Since the python version key is a Python-only option, the `EngineConfig` class still doesn't seem like the appropriate place for that logic.)
wfleming
added a commit
that referenced
this pull request
Oct 10, 2016
Addresses #136 The changes made in #135 didn't account for configuring the languages with empty hash contents. With YAML parsing, something like ``` languages: python: ``` Gets parsed as `{ "languages" => { "python" => "" } }`, leading to a `NoMethodError` when the Python class attempted to discover the configured Python version. `EngineConfig` already had logic to ensure a language configuration was a hash, so this makes the appropriate coercing method public & uses it from the Python class. (Since the python version key is a Python-only option, the `EngineConfig` class still doesn't seem like the appropriate place for that logic.)
wfleming
added a commit
that referenced
this pull request
Oct 10, 2016
Addresses #136 The changes made in #135 didn't account for configuring the languages with empty hash contents. With YAML parsing, something like ``` languages: python: ``` Gets parsed as `{ "languages" => { "python" => "" } }`, leading to a `NoMethodError` when the Python class attempted to discover the configured Python version. `EngineConfig` already had logic to ensure a language configuration was a hash, so this makes the appropriate coercing method public & uses it from the Python class. (Since the python version key is a Python-only option, the `EngineConfig` class still doesn't seem like the appropriate place for that logic.)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
By default we use
python2in this engine, which unfortunately chokes on some newer python syntax. This updates the engine to support both versions of Python: the default remains 2, but 3 can be configured with a setting in.codeclimate.yml:The
parser.pyscript has been updated to work with both versions of python, and theparser.rbhas been updated to switch which python binary it will use depending on the config.cc @codeclimate/review